package day03;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/**
 * 输入某人生日，格式为"yyyy-MM-dd"，输出到现在为止经过了多少周。
 * @author Bonnie
 *
 */
public class Test03 {
    public static void main(String[] args) throws ParseException {
        System.out.print("请输入某人生日，格式为\"yyyy-MM-dd\"：");
        Scanner console = new Scanner(System.in);
        String birth = console.nextLine();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
        Date date = sdf.parse(birth);
        Date time = new Date();
        long t = time.getTime() - date.getTime();
        t = t / (1000 * 60 * 60 * 24 * 7);
        System.out.println("经过了" + t + "周");
    }
}
